<!DOCTYPE html>
<html lang="zh">
    <head>
    <!--
        © Material Theme
        https://github.com/viosey/hexo-theme-material
        Version: 1.3.4 -->

    <!-- Title -->
    
    <title>
        
            Linux--网络管理（7层结构、netstat、ifconfig、配置文件、虚拟机中的网络连接） | 
        
        Twilight&#39;s Blog
    </title>

    <!-- Meta & Info -->
    <meta charset="utf-8">

    <!-- dns prefetch -->
    <meta http-equiv="x-dns-prefetch-control" content="on">
    
    
        <link rel="dns-prefetch" href="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"/>
    
    
        <link rel="dns-prefetch" href="https://changyan.sohu.com"/>
    
    
    
    

    <meta http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="theme-color" content="#0097A7">
    <meta name="author" content="wangchao">
    <meta name="description" content="null">
    <meta name="keywords" content="null,Linux">

    <!-- Favicons -->
    <link rel="icon shortcut" type="image/ico" href="/img/favicon.png">
    <link rel="icon" sizes="192x192" href="/img/favicon.png">
    <link rel="apple-touch-icon" href="/img/favicon.png">

    <!--iOS -->
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-title" content="Title">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="480">

    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Twilight&#39;s Blog">

    <!-- The Open Graph protocol -->
    <meta property="og:url" content="http://yoursite.com">
    <meta property="og:type" content="blog">
    <meta property="og:title" content="Linux--网络管理（7层结构、netstat、ifconfig、配置文件、虚拟机中的网络连接） | Twilight&#39;s Blog">
    <meta property="og:description" content="null">
    <meta property="og:article:tag" content="Linux"> 

    <!--[if lte IE 9]>
        <link rel="stylesheet" href="/css/ie-blocker.css">

        
            <script src="/js/ie-blocker.zhCN.js"></script>
        
    <![endif]-->

    <!-- Import CSS & jQuery -->
    
        <link rel="stylesheet" href="/css/material.min.css">
        <link rel="stylesheet" href="/css/style.min.css">
        <!-- Config CSS -->


<!-- Other Styles -->
<style>
  body, html {
    font-family: Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  }

  a {
    color: #00838F;
  }

  .mdl-card__media,
  #search-label,
  #search-form-label:after,
  #scheme-Paradox .hot_tags-count,
  #scheme-Paradox .sidebar_archives-count,
  #scheme-Paradox .sidebar-colored .sidebar-header,
  #scheme-Paradox .sidebar-colored .sidebar-badge{
    background-color: #0097A7 !important;
  }

  /* Sidebar User Drop Down Menu Text Color */
  #scheme-Paradox .sidebar-colored .sidebar-nav>.dropdown>.dropdown-menu>li>a:hover,
  #scheme-Paradox .sidebar-colored .sidebar-nav>.dropdown>.dropdown-menu>li>a:focus {
    color: #0097A7 !important;
  }

  #post_entry-right-info,
  .sidebar-colored .sidebar-nav li:hover > a,
  .sidebar-colored .sidebar-nav li:hover > a i,
  .sidebar-colored .sidebar-nav li > a:hover,
  .sidebar-colored .sidebar-nav li > a:hover i,
  .sidebar-colored .sidebar-nav li > a:focus i,
  .sidebar-colored .sidebar-nav > .open > a,
  .sidebar-colored .sidebar-nav > .open > a:hover,
  .sidebar-colored .sidebar-nav > .open > a:focus,
  #ds-reset #ds-ctx .ds-ctx-entry .ds-ctx-head a {
    color: #0097A7 !important;
  }

  .toTop {
    background: #757575 !important;
  }

  .material-layout .material-post>.material-nav,
  .material-layout .material-index>.material-nav,
  .material-nav a {
    color: #757575;
  }

  #scheme-Paradox .MD-burger-layer {
    background-color: #757575;
  }

  #scheme-Paradox #post-toc-trigger-btn {
    color: #757575;
  }

  .post-toc a:hover {
    color: #00838F;
    text-decoration: underline;
  }

</style>


<!-- Theme Background Related-->

    <style>
      body{
        background-image: url(/img/bg.jpg);
      }
    </style>




<!-- Fade Effect -->

    <style>
      .fade {
        transition: all 800ms linear;
        -webkit-transform: translate3d(0,0,0);
        -moz-transform: translate3d(0,0,0);
        -ms-transform: translate3d(0,0,0);
        -o-transform: translate3d(0,0,0);
        transform: translate3d(0,0,0);
        opacity: 1;
      }

      .fade.out{
        opacity: 0;
      }
    </style>


        <script src="/js/jquery.min.js"></script>
        <script src="/js/queue.js"></script>
    

    <!-- UC Browser Compatible -->
    <script>
        var agent = navigator.userAgent.toLowerCase();
        if(agent.indexOf('ucbrowser')>0) {
            document.write("<link rel=\"stylesheet\" href=\"/css/uc.css\">");
            alert('由于 UC 浏览器使用极旧的内核，而本网站使用了一些新的特性。\n为了您能更好的浏览，推荐使用 Chrome 或 Firefox 浏览器。');
        }
    </script>

    

    


    <!-- Bing Background -->
    

    <!-- Custom Head -->
    
</head>


    
        <body id="scheme-Paradox" class="lazy">
            <div class="material-layout  mdl-js-layout has-drawer is-upgraded">
                

                <!-- Main Container -->
                <main class="material-layout__content" id="main">

                    <!-- Top Anchor -->
                    <div id="top"></div>

                    
                        <!-- Hamburger Button -->
                        <button class="MD-burger-icon sidebar-toggle">
                            <span class="MD-burger-layer"></span>
                        </button>
                    

                    <!-- Post TOC -->

    
    <!-- Back Button -->
    <!--
    <div class="material-back" id="backhome-div" tabindex="0">
        <a class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon"
           href="#" onclick="window.history.back();return false;"
           target="_self"
           role="button"
           data-upgraded=",MaterialButton,MaterialRipple">
            <i class="material-icons" role="presentation">arrow_back</i>
            <span class="mdl-button__ripple-container">
                <span class="mdl-ripple"></span>
            </span>
        </a>
    </div>
    -->

    <!-- Left aligned menu below button -->
    <button id="post-toc-trigger-btn"
        class="mdl-button mdl-js-button mdl-button--icon">
        <i class="material-icons">format_list_numbered</i>
    </button>

    <ul class="post-toc-wrap mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect" for="post-toc-trigger-btn" style="max-height:80vh; overflow-y:scroll;">
        <ol class="post-toc"><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#ISO网络7层结构"><span class="post-toc-number">1.</span> <span class="post-toc-text">ISO网络7层结构</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#TCP-IP模型"><span class="post-toc-number">2.</span> <span class="post-toc-text">TCP/IP模型</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#netstat-an"><span class="post-toc-number">3.</span> <span class="post-toc-text">netstat -an</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#常见端口："><span class="post-toc-number">3.1.</span> <span class="post-toc-text">常见端口：</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#ifconfig-临时配置IP地址"><span class="post-toc-number">4.</span> <span class="post-toc-text">ifconfig 临时配置IP地址</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#修改配置文件配置IP地址"><span class="post-toc-number">5.</span> <span class="post-toc-text">修改配置文件配置IP地址</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#etc-sysconfig-network-scripts-ifcfg-ens33"><span class="post-toc-number">5.1.</span> <span class="post-toc-text">/etc/sysconfig/network-scripts/ifcfg-ens33</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#etc-sysconfig-network-和-etc-hostname"><span class="post-toc-number">5.2.</span> <span class="post-toc-text">/etc/sysconfig/network 和 /etc/hostname</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#etc-resolv-conf"><span class="post-toc-number">5.3.</span> <span class="post-toc-text">/etc/resolv.conf</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#其他方式"><span class="post-toc-number">6.</span> <span class="post-toc-text">其他方式</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#虚拟机网络参数配置"><span class="post-toc-number">7.</span> <span class="post-toc-text">虚拟机网络参数配置</span></a></li></ol>

        <!--
        <li class="mdl-menu__item">
            Some Action
        </li>
        -->
    </ul>




<!-- Layouts -->

    <!-- Post Module -->
    <div class="material-post_container">

        <div class="material-post mdl-grid">
            <div class="mdl-card mdl-shadow--4dp mdl-cell mdl-cell--12-col">

                <!-- Post Header(Thumbnail & Title) -->
                
    <!-- Paradox Post Header -->
    
        <!-- Custom Thumbnail -->
        <div class="post_thumbnail-custom mdl-card__media mdl-color-text--grey-50" style="background-image:url(http://otbrtx8bw.bkt.clouddn.com/%E5%BF%85%E5%BA%94.jpg)">
    
            <p class="article-headline-p">
                Linux--网络管理（7层结构、netstat、ifconfig、配置文件、虚拟机中的网络连接）
            </p>
        </div>





                
                    <!-- Paradox Post Info -->
                    <div class="mdl-color-text--grey-700 mdl-card__supporting-text meta">

    <!-- Author Avatar -->
    <div id="author-avatar">
        <img src="/img/avatar.png" width="44px" height="44px" alt="Author Avatar"/>
    </div>
    <!-- Author Name & Date -->
    <div>
        <strong>wangchao</strong>
        <span>7月 24, 2017</span>
    </div>

    <div class="section-spacer"></div>

    <!-- Favorite -->
    <!--
        <button id="article-functions-like-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon btn-like">
            <i class="material-icons" role="presentation">favorite</i>
            <span class="visuallyhidden">favorites</span>
        </button>
    -->

    <!-- Qrcode -->
    

    <!-- Tags (bookmark) -->
    
    <button id="article-functions-viewtags-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
        <i class="material-icons" role="presentation">bookmark</i>
        <span class="visuallyhidden">bookmark</span>
    </button>
    <ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="article-functions-viewtags-button">
        <li class="mdl-menu__item">
        <a class="post_tag-link" href="/tags/Linux/">Linux</a>
    </ul>
    

    <!-- Share -->
    <button id="article-fuctions-share-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
    <i class="material-icons" role="presentation">share</i>
    <span class="visuallyhidden">share</span>
</button>
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="article-fuctions-share-button">
    
    <!-- Leancloud Views -->
        <a class="post_share-link" href="#">
            <li class="mdl-menu__item">
                <span id="/2017/07/24/Linux-网络管理（7层结构、netstat、ifconfig）/" class="leancloud-views_num" data-flag-title="Linux--网络管理（7层结构、netstat、ifconfig、配置文件、虚拟机中的网络连接）">
     &nbsp;浏览量
</span>

            </li>
        </a>
    

    

    <!-- Share Weibo -->
    
        <a class="post_share-link" href="http://service.weibo.com/share/share.php?appkey=&title=Linux--网络管理（7层结构、netstat、ifconfig、配置文件、虚拟机中的网络连接）&url=http://yoursite.com//2017/07/24/Linux-网络管理（7层结构、netstat、ifconfig）/index.html&pic=&searchPic=false&style=simple" target="_blank">
            <li class="mdl-menu__item">
                分享到微博
            </li>
        </a>
    

    <!-- Share Twitter -->
    
        <a class="post_share-link" href="https://twitter.com/intent/tweet?text=Linux--网络管理（7层结构、netstat、ifconfig、配置文件、虚拟机中的网络连接）&url=http://yoursite.com//2017/07/24/Linux-网络管理（7层结构、netstat、ifconfig）/index.html&via=wangchao" target="_blank">
            <li class="mdl-menu__item">
                分享到 Twitter
            </li>
        </a>
    

    <!-- Share Facebook -->
    
        <a class="post_share-link" href="https://www.facebook.com/sharer/sharer.php?u=http://yoursite.com//2017/07/24/Linux-网络管理（7层结构、netstat、ifconfig）/index.html" target="_blank">
            <li class="mdl-menu__item">
                分享到 Facebook
            </li>
        </a>
    

    <!-- Share Google+ -->
    
        <a class="post_share-link" href="https://plus.google.com/share?url=http://yoursite.com//2017/07/24/Linux-网络管理（7层结构、netstat、ifconfig）/index.html" target="_blank">
            <li class="mdl-menu__item">
                分享到 Google+
            </li>
        </a>
    

    <!-- Share LinkedIn -->
    

    <!-- Share QQ -->
    
        <a class="post_share-link" href="http://connect.qq.com/widget/shareqq/index.html?site=Twilight&#39;s Blog&title=Linux--网络管理（7层结构、netstat、ifconfig、配置文件、虚拟机中的网络连接）&summary=null&pics=http://yoursite.com/img/favicon.png&url=http://yoursite.com/2017/07/24/Linux-网络管理（7层结构、netstat、ifconfig）/index.html" target="_blank">
            <li class="mdl-menu__item">
                分享到 QQ
            </li>
        </a>
    

    <!-- Share Telegram -->
    
</ul>

</div>

                

                <!-- Post Content -->
                <div id="post-content" class="mdl-color-text--grey-700 mdl-card__supporting-text fade out">
    
        <p>说到Linux是一个悲伤的故事，早就想学了现在还是小白水平。连个tomcat服务都搞不定。痛哉痛哉</p>
<h1 id="ISO网络7层结构"><a href="#ISO网络7层结构" class="headerlink" title="ISO网络7层结构"></a>ISO网络7层结构</h1><table>
<thead>
<tr>
<th style="text-align:center">层次</th>
<th style="text-align:center">用途</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">应用层</td>
<td style="text-align:center">用户接口</td>
</tr>
<tr>
<td style="text-align:center">表示层</td>
<td style="text-align:center">数据的表示形式。特定功能的实现（加密）</td>
</tr>
<tr>
<td style="text-align:center">会话层</td>
<td style="text-align:center">对应用会话的管理、同步、是否需要传递</td>
</tr>
<tr>
<td style="text-align:center">传输层</td>
<td style="text-align:center">可靠与不可靠的传输、传输前的错误检测与修正</td>
</tr>
<tr>
<td style="text-align:center">网络层</td>
<td style="text-align:center">提供逻辑地址、选路</td>
</tr>
<tr>
<td style="text-align:center">数据链路层</td>
<td style="text-align:center">帧、用Mac地址访问没接、错误检测与修正</td>
</tr>
<tr>
<td style="text-align:center">物理层</td>
<td style="text-align:center">设备之间的比特流的传递、物理接口、电器特征等</td>
</tr>
</tbody>
</table>
<h1 id="TCP-IP模型"><a href="#TCP-IP模型" class="headerlink" title="TCP/IP模型"></a>TCP/IP模型</h1><ul>
<li>应用层</li>
<li>传输层 </li>
<li>网际互联层 </li>
<li>网络接口层</li>
</ul>
<h1 id="netstat-an"><a href="#netstat-an" class="headerlink" title="netstat -an"></a>netstat -an</h1><p>查看本机启用的端口</p>
<ul>
<li>-a 查看所有连接和监听端口(ano可同时使用)</li>
<li>-n 显示IP地址和端口号，而不是显示域名和服务名</li>
<li>-o 显示活动的 TCP 连接并包括每个连接的进程 ID (PID)</li>
<li>-r 显示 IP 路由表的内容。该参数与 route print 命令等价。 </li>
</ul>
<p>端口状态：</p>
<ul>
<li>LISTENING 端口是开放的，等待连接，但还没有被连接。就像你房子的门已经敞开的，但还没有人进来。</li>
<li>ESTABLISHED 表示已经建立连接。两台机器正在通信。</li>
</ul>
<h2 id="常见端口："><a href="#常见端口：" class="headerlink" title="常见端口："></a>常见端口：</h2><ul>
<li><strong>FTP 20 21 </strong></li>
<li><strong>SSH 22 </strong></li>
<li><strong>telnet 23 </strong></li>
<li><strong>DNS 53</strong> </li>
<li><strong>http 80 </strong></li>
<li><strong>SMTP(邮件) 25 </strong></li>
<li><strong>POP3(收邮件) 110 </strong></li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div></pre></td><td class="code"><pre><div class="line">C:\Users\wangchao&gt;netstat -an</div><div class="line">活动连接</div><div class="line"></div><div class="line">  协议  本地地址          外部地址        状态</div><div class="line">  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING</div><div class="line">  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING</div><div class="line">  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING</div><div class="line">  TCP    0.0.0.0:902            0.0.0.0:0              LISTENING</div><div class="line">  TCP    0.0.0.0:912            0.0.0.0:0              LISTENING</div><div class="line">  TCP    0.0.0.0:1433           0.0.0.0:0              LISTENING</div><div class="line">  TCP    0.0.0.0:49152          0.0.0.0:0              LISTENING</div><div class="line">  TCP    0.0.0.0:49153          0.0.0.0:0              LISTENING</div><div class="line">  TCP    0.0.0.0:49154          0.0.0.0:0              LISTENING</div><div class="line">  TCP    0.0.0.0:49155          0.0.0.0:0              LISTENING</div><div class="line">  TCP    0.0.0.0:49177          0.0.0.0:0              LISTENING</div><div class="line">  TCP    127.0.0.1:1434         0.0.0.0:0              LISTENING</div><div class="line">  TCP    127.0.0.1:4300         0.0.0.0:0              LISTENING</div><div class="line">  TCP    127.0.0.1:4301         0.0.0.0:0              LISTENING</div><div class="line">  TCP    172.25.208.32:139      0.0.0.0:0              LISTENING</div><div class="line">  TCP    172.25.208.32:50180    108.177.97.188:5228    ESTABLISHED</div><div class="line">  TCP    172.25.208.32:50234    115.182.41.173:80      ESTABLISHED</div><div class="line">  TCP    172.25.208.32:52330    223.252.199.6:6003     ESTABLISHED</div><div class="line">  TCP    172.25.208.32:53614    115.182.41.173:80      ESTABLISHED</div><div class="line">  TCP    172.25.208.32:54164    115.182.41.173:80      ESTABLISHED</div><div class="line">  TCP    172.25.208.32:54171    115.182.41.49:7080     ESTABLISHED</div><div class="line">  TCP    172.25.208.32:54526    14.17.52.183:80        CLOSE_WAIT</div><div class="line">  TCP    172.25.208.32:54745    115.182.41.180:80      ESTABLISHED</div><div class="line">  TCP    172.25.208.32:55290    101.201.173.115:80     ESTABLISHED</div><div class="line">  TCP    172.25.208.32:55329    101.201.173.115:80     ESTABLISHED</div><div class="line">  TCP    172.25.208.32:55398    106.120.188.49:80      TIME_WAIT</div><div class="line">  TCP    172.25.208.32:55401    183.36.108.223:443     TIME_WAIT</div><div class="line">  TCP    172.25.208.32:55411    180.163.21.35:80       ESTABLISHED</div><div class="line">  TCP    172.25.208.32:55412    64.233.189.138:443     SYN_SENT</div><div class="line">  TCP    172.25.208.32:55413    64.233.189.102:443     SYN_SENT</div><div class="line">  TCP    172.25.208.32:55414    64.233.189.102:443     SYN_SENT</div><div class="line">  TCP    172.25.208.32:55415    64.233.189.138:443     SYN_SENT</div><div class="line">  TCP    172.25.208.32:55416    59.111.160.195:80      ESTABLISHED</div><div class="line">  TCP    192.168.42.1:139       0.0.0.0:0              LISTENING</div><div class="line">  TCP    192.168.247.1:139      0.0.0.0:0              LISTENING</div><div class="line">  TCP    [::]:80                [::]:0                 LISTENING</div><div class="line">  TCP    [::]:135               [::]:0                 LISTENING</div><div class="line">  TCP    [::]:445               [::]:0                 LISTENING</div><div class="line">  TCP    [::]:1433              [::]:0                 LISTENING</div><div class="line">  TCP    [::]:49152             [::]:0                 LISTENING</div><div class="line">  TCP    [::]:49153             [::]:0                 LISTENING</div><div class="line">  TCP    [::]:49154             [::]:0                 LISTENING</div><div class="line">  TCP    [::]:49155             [::]:0                 LISTENING</div><div class="line">  TCP    [::]:49177             [::]:0                 LISTENING</div><div class="line">  TCP    [::1]:1434             [::]:0                 LISTENING</div><div class="line">  UDP    0.0.0.0:4018           *:*                    </div><div class="line">  UDP    0.0.0.0:5353           *:*                    </div><div class="line">  UDP    0.0.0.0:5353           *:*                    </div><div class="line">  UDP    0.0.0.0:5353           *:*                    </div><div class="line">  UDP    0.0.0.0:5353           *:*                    </div><div class="line">  UDP    0.0.0.0:5353           *:*                    </div><div class="line">  UDP    0.0.0.0:5353           *:*                    </div><div class="line">  UDP    0.0.0.0:5353           *:*                    </div><div class="line">  UDP    0.0.0.0:5355           *:*                    </div><div class="line">  UDP    0.0.0.0:50020          *:*                    </div><div class="line">  UDP    0.0.0.0:52451          *:*                    </div><div class="line">  UDP    0.0.0.0:54543          *:*                    </div><div class="line">  UDP    0.0.0.0:57313          *:*                    </div><div class="line">  UDP    0.0.0.0:60018          *:*                    </div><div class="line">  UDP    0.0.0.0:60019          *:*                    </div><div class="line">  UDP    0.0.0.0:60020          *:*                    </div><div class="line">  UDP    0.0.0.0:63636          *:*                    </div><div class="line">  UDP    0.0.0.0:65532          *:*                    </div><div class="line">  UDP    127.0.0.1:1900         *:*                    </div><div class="line">  UDP    127.0.0.1:53883        *:*                    </div><div class="line">  UDP    172.25.208.32:137      *:*                    </div><div class="line">  UDP    172.25.208.32:138      *:*                    </div><div class="line">  UDP    172.25.208.32:1900     *:*                    </div><div class="line">  UDP    172.25.208.32:53882    *:*                    </div><div class="line">  UDP    192.168.42.1:137       *:*                    </div><div class="line">  UDP    192.168.42.1:138       *:*                    </div><div class="line">  UDP    192.168.42.1:1900      *:*                    </div><div class="line">  UDP    192.168.247.1:137      *:*                    </div><div class="line">  UDP    192.168.247.1:138      *:*                    </div><div class="line">  UDP    192.168.247.1:1900     *:*                    </div><div class="line">  UDP    [::]:5353              *:*                    </div><div class="line">  UDP    [::]:5353              *:*                    </div><div class="line">  UDP    [::]:5353              *:*                    </div><div class="line">  UDP    [::]:5353              *:*                    </div><div class="line">  UDP    [::]:5355              *:*                    </div><div class="line">  UDP    [::1]:1900             *:*                    </div><div class="line">  UDP    [::1]:53881            *:*                    </div><div class="line">  UDP    [fe80::7134:d4df:12f4:7846%16]:546  *:*                    </div><div class="line">  UDP    [fe80::7134:d4df:12f4:7846%16]:546  *:*                    </div><div class="line">  UDP    [fe80::7134:d4df:12f4:7846%16]:1900  *:*                    </div><div class="line">  UDP    [fe80::95c6:d3f1:50e1:8ae4%15]:546  *:*                    </div><div class="line">  UDP    [fe80::95c6:d3f1:50e1:8ae4%15]:546  *:*                    </div><div class="line">  UDP    [fe80::95c6:d3f1:50e1:8ae4%15]:1900  *:*                    </div><div class="line">  UDP    [fe80::f053:ca43:6de1:5420%17]:546  *:*                    </div><div class="line">  UDP    [fe80::f053:ca43:6de1:5420%17]:546  *:*                    </div><div class="line">  UDP    [fe80::f053:ca43:6de1:5420%17]:1900  *:*                    </div><div class="line">  UDP    [fe80::f053:ca43:6de1:5420%17]:53880  *:*</div></pre></td></tr></table></figure>
<h1 id="ifconfig-临时配置IP地址"><a href="#ifconfig-临时配置IP地址" class="headerlink" title="ifconfig 临时配置IP地址"></a>ifconfig 临时配置IP地址</h1><ul>
<li><strong>ifconfig ：查看网络状态</strong></li>
<li><strong>ifconfig eth0 192.168.254.200 netmask 255.255.255.0 ： 临时配置IP和子网掩码</strong></li>
<li><strong>ifconfig 网卡名 down/up  ： 关闭、打开网卡</strong></li>
<li><strong>ifconfig 网卡名 ipv4 ： 设置ipv4地址</strong></li>
</ul>
<h1 id="修改配置文件配置IP地址"><a href="#修改配置文件配置IP地址" class="headerlink" title="修改配置文件配置IP地址"></a>修改配置文件配置IP地址</h1><h2 id="etc-sysconfig-network-scripts-ifcfg-ens33"><a href="#etc-sysconfig-network-scripts-ifcfg-ens33" class="headerlink" title="/etc/sysconfig/network-scripts/ifcfg-ens33"></a>/etc/sysconfig/network-scripts/ifcfg-ens33</h2><p>网卡配置文件</p>
<ul>
<li><strong>DEVICE=eth0</strong> <strong>网卡设备名，需要和文件名中的网卡名一致</strong></li>
<li><strong>BOOTPROTO=none(none、dhcp、dhcp)</strong> <strong>是否自动获取IP（如果是dhcp，下面的内容无需配置）</strong></li>
<li><strong>HWADDR</strong>   <strong>MAC地址</strong></li>
<li><strong>NM_CONTROLLED=yes(no)</strong> <strong>是否可以被Network Manager图形管理工具管理</strong></li>
<li><strong>ONBOOT=yes(no)</strong>  <strong>是否随着网络服务启动(centos6以上默认是no)</strong></li>
<li><strong>TYPE=Ethernet</strong> <strong>类型为以太网</strong></li>
<li><strong>UUID</strong> <strong>唯一识别码</strong></li>
<li><strong>IPADDR</strong> <strong>ip地址</strong></li>
<li><strong>NETMASK</strong> <strong>子网掩码</strong></li>
<li><strong>GATEWAY</strong> <strong>网关</strong></li>
<li><strong>DNS1</strong> <strong>dns</strong></li>
<li><strong>IPV6INIT=no</strong>  <strong>ipv6没有启动</strong></li>
<li><strong>USERCTL=no</strong> <strong>不允许非root用户控制网卡</strong></li>
</ul>
<h2 id="etc-sysconfig-network-和-etc-hostname"><a href="#etc-sysconfig-network-和-etc-hostname" class="headerlink" title="/etc/sysconfig/network 和 /etc/hostname"></a>/etc/sysconfig/network 和 /etc/hostname</h2><p>主机名文件<br>CentOS7中主机名文件为hostname，内容是：<br><code>localhost.localdomain</code></p>
<p>也可以通过hostname命令临时更改主机名<br>hostname newname 临时更改主机名为newname（不加参数表示查看当前主机名）</p>
<h2 id="etc-resolv-conf"><a href="#etc-resolv-conf" class="headerlink" title="/etc/resolv.conf"></a>/etc/resolv.conf</h2><p>DNS 配置文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">nameserver 202.106.0.20(可以写多个)</div><div class="line">search localhost</div></pre></td></tr></table></figure>
<h1 id="其他方式"><a href="#其他方式" class="headerlink" title="其他方式"></a>其他方式</h1><ul>
<li>图形界面</li>
<li>setup工具</li>
</ul>
<h1 id="虚拟机网络参数配置"><a href="#虚拟机网络参数配置" class="headerlink" title="虚拟机网络参数配置"></a>虚拟机网络参数配置</h1><ul>
<li>将 /etc/sysconfig/network-scripts/文件中的onboot改为yes表示开机自启网络。</li>
<li>将BOOTPROTO设置为dhcp，如果是none则需要手动设置ip地址，设置的方法是在文件尾部加上IPADDR和NETMASK属性表示ip地址和子网掩码</li>
<li>然后用service network restart 重启网络即可生效</li>
</ul>
<p>虚拟机中的连接方式有三种：</p>
<ul>
<li>桥接：虚拟机会被当成一个真正的电脑，占用局域网中的一个ip地址，</li>
<li>NAT：可以上网，可以连通主机</li>
<li>仅主机模式：只能连通主机，不能上网</li>
</ul>
<p>在校园网中使用桥接会获得一个校园网的ip，但是该ip没有登录，所以不能上网。因此在校园网中使用NAT便可以上网，此时的ip为(192.168.42.132),与本机的ip并不在一个网段中(172.25.233.40)<br>service network start/stop/restart 开启关闭重启网络服务</p>

    

    
</div>


                

                <!-- Post Comments -->
                
                    


    <!-- 使用 changyan -->
    <div id="changyan-comment">
        <!--PC和WAP自适应版-->
<div id="SOHUCS" sid="2017/07/24/Linux-网络管理（7层结构、netstat、ifconfig）/"  ></div>
<script type="text/javascript">
(function(){
var appid = 'cysVH2p6S';
var conf = '7d191ef850d424bb873df33179309db5';
var width = window.innerWidth || document.documentElement.clientWidth;
if (width < 960) {
window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){window.changyan.api.config({appid:appid,conf:conf})}); } })(); </script>

    </div>
    <style>
        #changyan-comment{
            background-color: #eee;
            padding: 2pc;
        }
    </style>






                
            </div>

            <!-- Post Prev & Next Nav -->
            <nav class="material-nav mdl-color-text--grey-50 mdl-cell mdl-cell--12-col">
    <!-- Prev Nav -->
    
        <a href="/2017/07/24/Linux-用户、用户组/" id="post_nav-newer" class="prev-content">
            <button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon mdl-color--white mdl-color-text--grey-900" role="presentation">
                <i class="material-icons">arrow_back</i>
            </button>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            新篇
        </a>
    

    <!-- Section Spacer -->
    <div class="section-spacer"></div>

    <!-- Next Nav -->
    
        <a href="/2017/07/22/JSP-JSTL-import、redirect、url处理、常用函数/" id="post_nav-older" class="next-content">
            旧篇
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon mdl-color--white mdl-color-text--grey-900" role="presentation">
                <i class="material-icons">arrow_forward</i>
            </button>
        </a>
    
</nav>

        </div>
    </div>



                    
                        <!-- Overlay For Active Sidebar -->
<div class="sidebar-overlay"></div>

<!-- Material sidebar -->
<aside id="sidebar" class="sidebar sidebar-colored sidebar-fixed-left" role="navigation">
    <div id="sidebar-main">
        <!-- Sidebar Header -->
        <div class="sidebar-header header-cover" style="background-image: url(/img/sidebar_header.jpg);">
    <!-- Top bar -->
    <div class="top-bar"></div>

    <!-- Sidebar toggle button -->
    <button type="button" class="sidebar-toggle mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon" style="display: initial;" data-upgraded=",MaterialButton,MaterialRipple">
        <i class="material-icons">clear_all</i>
        <span class="mdl-button__ripple-container">
            <span class="mdl-ripple">
            </span>
        </span>
    </button>

    <!-- Sidebar Avatar -->
    <div class="sidebar-image">
        <img src="/img/avatar.png" alt="wangchao's avatar">
    </div>

    <!-- Sidebar Email -->
    <a data-toggle="dropdown" class="sidebar-brand" href="#settings-dropdown">
        twilight0402@163.com
        <b class="caret"></b>
    </a>
</div>


        <!-- Sidebar Navigation  -->
        <ul class="nav sidebar-nav">
    <!-- User dropdown  -->
    <li class="dropdown">
        <ul id="settings-dropdown" class="dropdown-menu">
            
                <li>
                    <a href="http://mail.163.com" target="_blank" title="Email Me">
                        
                            <i class="material-icons sidebar-material-icons sidebar-indent-left1pc-element">email</i>
                        
                        Email Me
                    </a>
                </li>
            
        </ul>
    </li>

    <!-- Homepage -->
    
        <li id="sidebar-first-li">
            <a href="/" target="_self">
                
                    <i class="material-icons sidebar-material-icons">home</i>
                
                主页
            </a>
        </li>
        
    

    <!-- Archives  -->
    
        <li class="dropdown">
            <a href="#" class="ripple-effect dropdown-toggle" data-toggle="dropdown">
                
                    <i class="material-icons sidebar-material-icons">inbox</i>
                
                    归档
                <b class="caret"></b>
            </a>
            <ul class="dropdown-menu">
            <li>
                <a class="sidebar_archives-link" href="/archives/2017/08/">八月 2017<span class="sidebar_archives-count">5</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/07/">七月 2017<span class="sidebar_archives-count">23</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/06/">六月 2017<span class="sidebar_archives-count">13</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/04/">四月 2017<span class="sidebar_archives-count">7</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/03/">三月 2017<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/02/">二月 2017<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/01/">一月 2017<span class="sidebar_archives-count">8</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/12/">十二月 2016<span class="sidebar_archives-count">4</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/11/">十一月 2016<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/09/">九月 2016<span class="sidebar_archives-count">3</span></a>
            </ul>
        </li>
        
    

    <!-- Categories  -->
    
        <li class="dropdown">
            <a href="#" class="ripple-effect dropdown-toggle" data-toggle="dropdown">
                
                    <i class="material-icons sidebar-material-icons">chrome_reader_mode</i>
                
                分类
                <b class="caret"></b>
            </a>
            <ul class="dropdown-menu">
                <li>
                <a class="sidebar_archives-link" href="/categories/CSS/">CSS<span class="sidebar_archives-count">9</span></a></li><li><a class="sidebar_archives-link" href="/categories/HTML/">HTML<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/categories/JSP/">JSP<span class="sidebar_archives-count">6</span></a></li><li><a class="sidebar_archives-link" href="/categories/Java/">Java<span class="sidebar_archives-count">8</span></a></li><li><a class="sidebar_archives-link" href="/categories/JavaScript/">JavaScript<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/categories/Linux/">Linux<span class="sidebar_archives-count">13</span></a></li><li><a class="sidebar_archives-link" href="/categories/MySQL/">MySQL<span class="sidebar_archives-count">7</span></a></li><li><a class="sidebar_archives-link" href="/categories/Servlet/">Servlet<span class="sidebar_archives-count">9</span></a></li><li><a class="sidebar_archives-link" href="/categories/jQuery/">jQuery<span class="sidebar_archives-count">7</span></a></li><li><a class="sidebar_archives-link" href="/categories/技术/">技术<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/categories/日常/">日常<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/categories/随笔/">随笔<span class="sidebar_archives-count">3</span></a>
            </ul>
        </li>
        
    

    <!-- Pages  -->
    
        <li>
            <a href="/tags" title="标签云">
                
                    <i class="material-icons sidebar-material-icons">cloud</i>
                
                标签云
            </a>
        </li>
        
            <li class="divider"></li>
        
    
        <li>
            <a href="/about" title="About">
                
                    <i class="material-icons sidebar-material-icons">person</i>
                
                About
            </a>
        </li>
        
    
        <li>
            <a href="/links" title="Social">
                
                    <i class="material-icons sidebar-material-icons">equalizer</i>
                
                Social
            </a>
        </li>
        
    

    <!-- Article Number  -->
    
        <li>
            <a href="/archives">
                文章总数
                <span class="sidebar-badge">71</span>
            </a>
        </li>
        
    
</ul>


        <!-- Sidebar Footer -->
        <!--
I'm glad you use this theme, the development is no so easy, I hope you can keep the copyright, I will thank you so much.
If you still want to delete the copyrights, could you still retain the first one? Which namely "Theme Material"
It will not impact the appearance and can give developers a lot of support :)

很高兴您使用并喜欢该主题，开发不易 十分谢谢与希望您可以保留一下版权声明。
如果您仍然想删除的话 能否只保留第一项呢？即 "Theme Material"
它不会影响美观并可以给开发者很大的支持和动力。 :)
-->

<!-- Sidebar Divider -->

    <div class="sidebar-divider"></div>


<!-- Theme Material -->


<!-- Help & Support -->
<!--

-->

<!-- Feedback -->
<!--

    <a href="https://github.com/viosey/hexo-theme-material/issues" target="_blank" class="sidebar-footer-text-a">
        <div class="sidebar-text mdl-button mdl-js-button mdl-js-ripple-effect sidebar-footer-text-div" data-upgraded=",MaterialButton,MaterialRipple">
        sidebar.feedback
        <span class="mdl-button__ripple-container"><span class="mdl-ripple"></span></span></div>
    </a>

-->

<!-- About Theme -->
<!--

    <a href="https://blog.viosey.com/index.php/Material.html" target="_blank" class="sidebar-footer-text-a">
        <div class="sidebar-text mdl-button mdl-js-button mdl-js-ripple-effect sidebar-footer-text-div" data-upgraded=",MaterialButton,MaterialRipple">
             sidebar.about_theme
            <span class="mdl-button__ripple-container"><span class="mdl-ripple"></span></span></div>
    </a>

-->

    </div>

    <!-- Sidebar Image -->
    

</aside>

                    

                    
                        <!-- Footer Top Button -->
                        <div class="toTop-wrap">
    <a href="#top" class="toTop">
        <i class="material-icons footer_top-i">expand_less</i>
    </a>
</div>

                    

                    <!--Footer-->
<footer class="mdl-mini-footer" id="bottom">
    
        <!-- Paradox Footer Left Section -->
        <div class="mdl-mini-footer--left-section sns-list">
    <!-- Twitter -->
    
        <a href="https://twitter.com/twitter" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn" style="background-image: url(/img/footer/footer_ico-twitter.svg);">
                <span class="visuallyhidden">Twitter</span>
            </button><!--
     --></a>
    

    <!-- Facebook -->
    
        <a href="https://www.facebook.com/facebook" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn" style="background-image: url(/img/footer/footer_ico-facebook.svg);">
                <span class="visuallyhidden">Facebook</span>
            </button><!--
     --></a>
    

    <!-- Google + -->
    
        <a href="https://www.google.com/" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn" style="background-image: url(/img/footer/footer_ico-gplus.svg);">
                <span class="visuallyhidden">Google Plus</span>
            </button><!--
     --></a>
    

    <!-- Weibo -->
    

    <!-- Instagram -->
    

    <!-- Tumblr -->
    

    <!-- Github -->
    
        <a href="https://github.com/1601436878" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn" style="background-image: url(/img/footer/footer_ico-github.svg);">
                <span class="visuallyhidden">Github</span>
            </button><!--
     --></a>
    

    <!-- LinkedIn -->
    

    <!-- Zhihu -->
    
        <a href="https://www.zhihu.com/people/wang-chao-50-78/activities" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn" style="background-image: url(/img/footer/footer_ico-zhihu.svg);">
                <span class="visuallyhidden">Zhihu</span>
            </button><!--
     --></a>
    

    <!-- Bilibili -->
    

    <!-- Telegram -->
    
</div>


        <!--Copyright-->
        <div id="copyright">
            Copyright&nbsp;©&nbsp;
            <script type="text/javascript">
                var fd = new Date();
                document.write(fd.getFullYear());
            </script>
            &nbsp;Twilight's Blog
        </div>

        <!-- Paradox Footer Right Section -->

        <!--
        I am glad you use this theme, the development is no so easy, I hope you can keep the copyright.
        It will not impact the appearance and can give developers a lot of support :)

        很高兴您使用该主题，开发不易，希望您可以保留一下版权声明。
        它不会影响美观并可以给开发者很大的支持。 :)
        -->

        <div class="mdl-mini-footer--right-section">
            <div>
                <div class="footer-develop-div">Powered by <a href="https://hexo.io" target="_blank" class="footer-develop-a">Hexo</a></div>
                <div class="footer-develop-div">Theme - <a href="https://github.com/viosey/hexo-theme-material" target="_blank" class="footer-develop-a">Material</a></div>
            </div>
        </div>
    
</footer>


                    <!-- Import File -->

    <script src="/js/lazyload.min.js"></script>
    <script src="/js/js.min.js"></script>



    <script src="/js/nprogress.js"></script>


<script type="text/javascript">
    NProgress.configure({
        showSpinner: true
    });
    NProgress.start();
    $('#nprogress .bar').css({
        'background': '#29d'
    });
    $('#nprogress .peg').css({
        'box-shadow': '0 0 10px #29d, 0 0 15px #29d'
    });
    $('#nprogress .spinner-icon').css({
        'border-top-color': '#29d',
        'border-left-color': '#29d'
    });
    setTimeout(function() {
        NProgress.done();
        $('.fade').removeClass('out');
    }, 800);
</script>





    <!-- Leancloud -->
    <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
    <script>
        AV.initialize('WJXlEXdVypRaytiRUYDL9Q4w-gzGzoHsz', 'qNN24AGgbaMqnDE7lqK8pwCD');
    </script>
    <script>
    function showTime(Counter) {
        var query = new AV.Query(Counter);
        $('.leancloud-views_num').each(function() {
            var url = $(this).attr('id').trim();
            query.equalTo('url', url);
            query.find({
                success: function(results) {
                    if (results.length === 0) {
                        var content = '0 ' + $(document.getElementById(url)).text();
                        $(document.getElementById(url)).text(content);
                        return;
                    }
                    for (var i = 0; i < results.length; i++) {
                        var object = results[i];
                        var content = object.get('time') + ' ' + $(document.getElementById(url)).text();
                        $(document.getElementById(url)).text(content);
                    }
                },
                error: function(object, error) {
                    console.log('Error: ' + error.code + ' ' + error.message);
                }
            });
        });
    }

    function addCount(Counter) {
      var Counter = AV.Object.extend('Counter');
      url = $('.leancloud-views_num').attr('id').trim();
      title = $('.leancloud-views_num').attr('data-flag-title').trim();
      var query = new AV.Query(Counter);
      query.equalTo('url', url);
      query.find({
          success: function(results) {
            if (results.length > 0) {
                var counter = results[0];
                counter.fetchWhenSave(true);
                counter.increment('time');
                counter.save(null, {
                    success: function(counter) {
                        var content =  counter.get('time') + ' ' + $(document.getElementById(url)).text();
                        $(document.getElementById(url)).text(content);
                    },
                    error: function(counter, error) {
                        console.log('Failed to save Visitor num, with error message: ' + error.message);
                    }
                });
            } else {
              var newcounter = new Counter();
              newcounter.set('title', title);
              newcounter.set('url', url);
              newcounter.set('time', 1);
              newcounter.save(null, {
                  success: function(newcounter) {
                      console.log('newcounter.get(\'time\')='+newcounter.get('time'));
                      var content = newcounter.get('time') + ' ' + $(document.getElementById(url)).text();
                      $(document.getElementById(url)).text(content);
                  },
                  error: function(newcounter, error) {
                      console.log('Failed to create');
                  }
              });
            }
        },
        error: function(error) {
            console.log('Error:' + error.code + ' ' + error.message);
        }
      });
    }
    $(function() {
        var Counter = AV.Object.extend('Counter');
        if ($('.leancloud-views_num').length === 1) {
            addCount(Counter);
        } else if ($('.post-title-link').length > 1) {
            showTime(Counter);
        }
    });
</script>







    <!-- 畅言公共 js 代码 start -->
		<script id="cy_cmt_num" src="https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=cysVH2p6S">
</script>
    <!-- 畅言公共 js 代码 end -->







<!-- Window Load-->
<script>
    $(window).load(function() {
        // Post_Toc parent position fixed
        $('.post-toc-wrap').parent('.mdl-menu__container').css('position', 'fixed');
    });
</script>

<!-- MathJax Load-->

<script>
    <!-- Offer LazyLoad -->
    queue.offer(function(){
        $('.lazy').lazyload({
            effect : 'show'
        });
    });

    <!-- Start Queue -->
    $(document).ready(function(){
        setInterval(function(){
            queue.execNext();
        },200);
    });
</script>

                </main>
            </div>
			<!--  -->
				<!--<script type="text/javascript" count="200" color="0,0,255" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js"></script>-->
			<!--  -->
        </body>
    
</html>
